/*
 * Word.java
 *
 * Created on June 25, 2006, 10:44 PM
 *
 */

package galronnlp.pcfg.lexicon;

import java.util.LinkedList;
import galronnlp.util.Symbol;

/**
 *
 * @author Daniel A. Galron
 */
public class Word implements LexicalEntry {
    private int arity = 0;
    private Symbol category;
    private Symbol entry;
    private double prob;
    
    
    /** Creates a new instance of Word */
    public Word(Symbol cat, Symbol entry, double prob) {
        this.category = cat;
        this.entry = entry;
        this.prob = prob;
    }
    
    public Symbol entry() {
        return this.entry;
    }
    
    public Symbol category() {
        return this.category;
    }
    
    public double prob() {
        return this.prob;
    }
    
    public double logProb() {
        return java.lang.Math.log(this.prob);
    }
    
    public Symbol LHS() {
        return this.category();
    }
    
    public LinkedList<Symbol> RHS() {
        LinkedList<Symbol> list = new LinkedList<Symbol>();
        list.addLast(this.entry());
        return list;
    }
    
    public int arity() {
        return arity;
    }    

    public boolean hasTerminalRHS() {
        return true;
    }
}
